<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="cepForm" enctype="multipart/form-data">
                <h1 class="title">
                    <a href="#" class="back" onclick="history.go(-1)"/>
                    Médico
                </h1>
                <p:growl showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Dados Gerais</h4></legend>
                            <p:panel id="customerPrimary" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">
                                <p:outputLabel value="Nome:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_19" style="width: 78.3%" value="#{managerDoctor.doctor.name}"/>
                                <div class="clear"/>

                                <p:outputLabel value="E-mail:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_8" value="#{managerDoctor.doctor.email}"/>

                                <p:outputLabel value="Telefone:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_8" value="#{managerDoctor.doctor.phone}"/>

                                <p:outputLabel value="Celular:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_8" value="#{managerDoctor.doctor.cellular}"/>
                                <p:outputLabel value="Sexo:" styleClass="grid_3"/>
                                <div class="grid_8">
                                    <p:selectOneMenu style="width: 103%;" panelStyle="width:150px;" value="#{managerDoctor.doctor.gender}" >   
                                        <f:selectItem itemLabel="" itemValue="" />  
                                        <f:selectItems value="#{managerDoctor.gender}" />  
                                    </p:selectOneMenu> 
                                </div>


                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Dados Profissionais</h4></legend>
                            <p:panel id="customerSecundary" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">
                                <p:outputLabel for="cbo" value="CBO:" styleClass="grid_3"/>
                                <p:autoComplete value="#{managerDoctor.cbo}" 
                                                id="cbo" completeMethod="#{managerCbo.autocomplete}"  
                                                var="cb" itemLabel="#{cb.cod.concat(' - ').concat(cb.descr)}"
                                                itemValue="#{cb}" forceSelection="true" panelStyle="height:200px;"
                                                styleClass="grid_19" style="width: 75.5%" dropdown="true" 
                                                converter="#{autocompleteconverter}" />

                                <p:outputLabel value="Número:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_8" value="#{managerDoctor.doctor.numberAdvice}"/>


                                <p:outputLabel value="Conselho:" styleClass="grid_3"/>
                                <div class="grid_8">
                                    <p:selectOneMenu style="width: 103%;" panelStyle="width:150px;" value="#{managerDoctor.doctor.advice}" >   
                                        <f:selectItem itemLabel="" itemValue="" />  
                                        <f:selectItems value="#{managerDoctor.selectAdviceProfessional()}" />  
                                    </p:selectOneMenu> 
                                </div>


                               
                                <p:outputLabel for="country" value="Estado:" styleClass="grid_3"/>
                                <p:autoComplete value="#{managerDoctor.country}" 
                                                id="country" completeMethod="#{managerCountry.autoComplete}"  
                                                var="c" itemLabel="#{c.name}"
                                                itemValue="#{c}" forceSelection="true"
                                                styleClass="grid_7" style="width: 28.8%" dropdown="true" 
                                                converter="#{autocompleteconverter}" />

                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Endereço</h4></legend>
                            <p:panel id="address" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:outputLabel value="CEP:" styleClass="grid_3" />
                                <p:inputMask mask="99.999-999" styleClass="grid_8" value="#{managerDoctor.address.zipcode}" />

                                <div class="clear"/>
                                <p:outputLabel value="Logradouro:" styleClass="grid_3" />
                                <p:inputText styleClass="grid_19" style="width: 78.3%" value="#{managerDoctor.address.publicPark}" />
                                <div class="clear"/>
                                <p:outputLabel value="Bairro:" styleClass="grid_3" />
                                <p:inputText  styleClass="grid_8" value="#{managerDoctor.address.neighborhood}" />
                                <p:outputLabel value="Complemento:" styleClass="grid_3" />
                                <p:inputText styleClass="grid_8" style="width: 31.5%"  value="#{managerDoctor.address.complement}" />
                                <div class="clear"/>
                                <p:outputLabel value="Nº:" styleClass="grid_3" />
                                <p:inputText styleClass="grid_8" value="#{managerDoctor.address.number}" />
                                <p:outputLabel  value="Cidade:" styleClass="grid_3"  />
                                <p:autoComplete styleClass="grid_7" dropdown="true" converter="#{autocompleteconverter}"   
                                                var="cityValue" itemLabel="#{cityValue.name.toString().concat(' - ')}#{cityValue.country.sgl}" 
                                                itemValue="#{cityValue}" value="#{managerDoctor.city}"
                                                scrollHeight="200" style="width: 28.7%" forceSelection="true"
                                                completeMethod="#{managerCity.autocomplete}" /> 
                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Acesso ao sistema</h4></legend>
                            <p:panel id="customerplain" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:outputLabel value="Login:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_20" autocomplete="false" value="#{managerDoctor.systemUser.login}" />
                                <div class="clear"/>
                                <p:outputLabel value="Senha:" styleClass="grid_3"/>
                                <p:password value="#{managerDoctor.passwd}" feedback="true"  autocomplete="false" styleClass="grid_8" />
                                <p:outputLabel value="Repita a Senha:" styleClass="grid_4"/>
                                <p:password value="#{managerDoctor.passwdConfirmation}" feedback="true" autocomplete="false" styleClass="grid_8" />

                            </p:panel>
                        </fieldset>
                        <div class="buttonAction">
                            <p:commandButton value="Salvar" icon="ui-icon-disk"
                                             process="@form" update="@form" actionListener="#{managerDoctor.create()}"
                                             styleClass="ui-priority-primary" />
                            <p:button href="indexdoctor.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                        </div >
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
